import _regeneratorRuntime from "@babel/runtime/regenerator";
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
var _excluded = ["organizationId"];
import request from 'utils/request';
import { CPAAS_FILE } from 'utils/config';
import { isTenantRoleLevel } from 'utils/utils';

function apiSource(param) {
  return isTenantRoleLevel() ? "".concat(param.organizationId, "/files/summary") : "files/summary";
}
/**
 * 查询文件汇总列表数据
 * @async
 * @function queryFileList
 * @param {object} param - 查询条件
 * @param {!number} [param.page = 0] - 数据页码
 * @param {!number} [param.size = 10] - 分页大小
 * @returns {object} fetch Promise
 */


export function queryFileList(_x) {
  return _queryFileList.apply(this, arguments);
}

function _queryFileList() {
  _queryFileList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(param) {
    var organizationId, other;
    return _regeneratorRuntime.wrap(function _callee$(_context) {
      while (1) {
        switch (_context.prev = _context.next) {
          case 0:
            organizationId = param.organizationId, other = _objectWithoutProperties(param, _excluded);
            return _context.abrupt("return", request("".concat(CPAAS_FILE, "/v1/").concat(apiSource(param)), {
              method: 'GET',
              query: _objectSpread({}, other)
            }));

          case 2:
          case "end":
            return _context.stop();
        }
      }
    }, _callee);
  }));
  return _queryFileList.apply(this, arguments);
}